package com.graduation.fq.teacher.process;

import org.json.JSONObject;

/**
 * @author jifang
 * @version 2016/5/24.
 */
public class ScoreUpdateProcess extends BaseProcess {
    private String url = "/choose/update_score.do?";
    private String studentId;
    private String courseId;
    private int score;

    public void setStudentId(String studentId) {
        this.studentId = studentId;
    }

    public void setCourseId(String courseId) {
        this.courseId = courseId;
    }

    public void setScore(int score) {
        this.score = score;
    }

    @Override
    String getRequestUrl() {
        String appendUrl = new StringBuilder("u_id=").append(studentId).append("&c_id=")
                .append(courseId).append("&number=").append(String.valueOf(score)).toString();
        return url + appendUrl;
    }

    @Override
    String getParameter() {
        return null;
    }

    @Override
    void onResult(JSONObject object) {
        int status = object.optInt("status");
        setStatus(status);
    }
}
